<template>
  <!-- 微信登录 -->
  <button
    class="WX-login-btn"
    open-type="getUserInfo"
    @getuserinfo="getuserinfo"
  >
    微信登录
  </button>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { wxLoginApi } from "@/api/login.js";
const userInfo = ref({});
const getuserinfo = (e) => {
  console.log(e);
  uni.login({
    success: (res) => {
      console.log(res);
      wxLoginApi({
        appCode: "1",
        code: res.code,
      }).then((res) => {
        console.log(res);
      });
    },
  });
};
</script>
